package org.alanlau.springjpa.repository;

import org.alanlau.springjpa.entity.Person;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Person dao层
 *
 * @author Alan
 * @data 2019/10/13 18:20
 */
public interface PersonRepository extends JpaRepository<Person, Long> {
    @Query(value = "select p from Person p where p.name= ?1")
    List<Person> findPersonName(String name);

    @Query(nativeQuery = true,value = "select * from person where name = ?1")
    List<Person> findNativeByName(String name);
}
